/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.games.epkb.entityClasses;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author plebani
 */
@Entity
@Table(name = "disk")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Disk.findAll", query = "SELECT d FROM Disk d"),
    @NamedQuery(name = "Disk.findById", query = "SELECT d FROM Disk d WHERE d.id = :id"),
    @NamedQuery(name = "Disk.findByDimension", query = "SELECT d FROM Disk d WHERE d.dimension = :dimension"),
    @NamedQuery(name = "Disk.findByMode", query = "SELECT d FROM Disk d WHERE d.mode = :mode"),
    @NamedQuery(name = "Disk.findByReadPower", query = "SELECT d FROM Disk d WHERE d.readPower = :readPower"),
    @NamedQuery(name = "Disk.findByWritePower", query = "SELECT d FROM Disk d WHERE d.writePower = :writePower"),
    @NamedQuery(name = "Disk.findByIdlePower", query = "SELECT d FROM Disk d WHERE d.idlePower = :idlePower"),
    @NamedQuery(name = "Disk.findByStandbyPower", query = "SELECT d FROM Disk d WHERE d.standbyPower = :standbyPower"),
    @NamedQuery(name = "Disk.findBySleepPower", query = "SELECT d FROM Disk d WHERE d.sleepPower = :sleepPower")})
public class Disk implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    private String id;
    @Column(name = "Dimension")
    private String dimension;
    @Column(name = "Mode")
    private String mode;
    @Column(name = "read_power")
    private String readPower;
    @Column(name = "write_power")
    private String writePower;
    @Column(name = "idle_power")
    private String idlePower;
    @Column(name = "standby_power")
    private String standbyPower;
    @Column(name = "sleep_power")
    private String sleepPower;
    @JoinColumn(name = "Id_Server", referencedColumnName = "ID")
    @ManyToOne
    private Server idServer;
    @JoinColumn(name = "ID", referencedColumnName = "ID", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Component component;

    public Disk() {
    }

    public Disk(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getDimension() {
        return dimension;
    }

    public void setDimension(String dimension) {
        this.dimension = dimension;
    }

    public String getMode() {
        return mode;
    }

    public void setMode(String mode) {
        this.mode = mode;
    }

    public String getReadPower() {
        return readPower;
    }

    public void setReadPower(String readPower) {
        this.readPower = readPower;
    }

    public String getWritePower() {
        return writePower;
    }

    public void setWritePower(String writePower) {
        this.writePower = writePower;
    }

    public String getIdlePower() {
        return idlePower;
    }

    public void setIdlePower(String idlePower) {
        this.idlePower = idlePower;
    }

    public String getStandbyPower() {
        return standbyPower;
    }

    public void setStandbyPower(String standbyPower) {
        this.standbyPower = standbyPower;
    }

    public String getSleepPower() {
        return sleepPower;
    }

    public void setSleepPower(String sleepPower) {
        this.sleepPower = sleepPower;
    }

    public Server getIdServer() {
        return idServer;
    }

    public void setIdServer(Server idServer) {
        this.idServer = idServer;
    }

    public Component getComponent() {
        return component;
    }

    public void setComponent(Component component) {
        this.component = component;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Disk)) {
            return false;
        }
        Disk other = (Disk) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "it.polimi.games.epkb.entityClasses.Disk[ id=" + id + " ]";
    }
    
}
